package ua.amsoft.brelok;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;

public class BrelokFragmentStatePagerAdapter extends FragmentStatePagerAdapter {
    
    private static final int FRAGMENTS_COUNT = 5;
    private static final int STATISTICS_FRAGMENTS = 0;
    private static final int ASSIGNMENTS_FRAGMENTS = 1;
    private static final int INBOX_ASSIGNMENTS_FRAGMENTS = 2;
    private static final int OUTBOX_ASSIGNMENTS_FRAGMENTS = 3;
    private static final int REPORTS_FRAGMENTS = 4;
    
    public BrelokFragmentStatePagerAdapter(final FragmentManager fm) {
        super(fm);
    }
    
    @Override
    public Fragment getItem(final int position) {
        switch (position) {
            case STATISTICS_FRAGMENTS:
                return new StatisticsFragment();
            case ASSIGNMENTS_FRAGMENTS:
                return new AssignmentsFragment();
            case INBOX_ASSIGNMENTS_FRAGMENTS:
                return new InboxAssignmentsFragment();
            case OUTBOX_ASSIGNMENTS_FRAGMENTS:
                return new OutboxAssignmentsFragment();
            case REPORTS_FRAGMENTS:
                return new ReportsFragment();
            default:
                return new Fragment();
        }
    }
    
    @Override
    public int getCount() {
        return BrelokFragmentStatePagerAdapter.FRAGMENTS_COUNT;
    }
    
    @Override
    public CharSequence getPageTitle(final int position) {
        return "";
    }
    
    @Override
    public void startUpdate(final ViewGroup container) {
        super.startUpdate(container);
    }
    
    @Override
    public void finishUpdate(final ViewGroup container) {
        super.finishUpdate(container);
    }
}
